<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/WEB-INF/template.xhtml">
    <ui:define name="content">
        <div class="Container100">
            <div class="ContainerIndent">
                <p:panel>
                    <span class="FontBold Fs18 hardblue Container100">DataTable</span>
                    <div class="Container100">
                        <div class="ContainerIndent">
                            <h:form id="form">
                                <p:dataTable id="singleDT"
                                             var="car"
                                             value="#{dtSelectionView.cars1}"
                                             rows="10"
                                             paginator="true"
                                             paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                             rowsPerPageTemplate="5,10,15"
                                             selectionMode="single"
                                             selection="#{dtSelectionView.selectedCar}"
                                             rowKey="#{car.id}">
                                    <f:facet name="header">
                                        DataTable
                                    </f:facet>
                                    <p:column headerText="Id" sortBy="#{car.id}">
                                        <h:outputText value="#{car.id}" />
                                    </p:column>
                                    <p:column headerText="Year" sortBy="#{car.year}">
                                        <h:outputText value="#{car.year}" />
                                    </p:column>
                                    <p:column headerText="Brand" sortBy="#{car.brand}">
                                        <h:outputText value="#{car.brand}" />
                                    </p:column>
                                    <p:column headerText="Color" sortBy="#{car.color}">
                                        <h:outputText value="#{car.color}" />
                                    </p:column>
                                    <f:facet name="footer">
                                        <p:commandButton value="View" process="singleDT" update=":form:carDetail" oncomplete="PF('carDialog').show()" />
                                    </f:facet>
                                </p:dataTable>

                                <p:dialog header="Car Info" widgetVar="carDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="false">
                                    <p:outputPanel id="carDetail" style="text-align:center;">
                                        <p:panelGrid columns="2" rendered="#{not empty dtSelectionView.selectedCar}">
                                            <h:outputText value="Id:"/>
                                            <h:outputText value="#{dtSelectionView.selectedCar.id}" />

                                            <h:outputText value="Year"/>
                                            <h:outputText value="#{dtSelectionView.selectedCar.year}" />

                                            <h:outputText value="Color:"/>
                                            <h:outputText value="#{dtSelectionView.selectedCar.color}" style="color:#{dtSelectionView.selectedCar.color}"/>

                                            <h:outputText value="Price"/>
                                            <h:outputText value="$#{dtSelectionView.selectedCar.price}" />
                                        </p:panelGrid>
                                    </p:outputPanel>
                                </p:dialog>
                                <div class="EmptyBox20"/>
                            </h:form>
                        </div>
                    </div>
                </p:panel>
                <div class="EmptyBox20"/>
            </div>
        </div>
    </ui:define>
</ui:composition>